<?php

namespace App\Http\Requests\Api;

class CompanyConnRequest extends ApiRequest
{
    public function rules()
    {
        return [
            'id' => 'bail|required|integer',
            'contacts' => 'bail|required|max:60',
            'mobile' => 'bail|required_without:phone|mobile_verification',
            'phone' => 'bail|required_without:mobile|check_company_phone',
            'fax' => 'check_fax',
            'email' => 'email',
            'qq' => 'check_qq',
            'website' => 'max:60',
            'region' => 'bail|required|integer',
            'address' => 'bail|required|max:200',
            'lines' => 'max:200',
            'longitude' => 'numeric',
            'latitude' => 'numeric',
        ];
    }

    public function attributes()
    {
        return [
            'contacts' => '联系人',
            'mobile' => '手机号码',
            'phone' => '座机号码',
            'fax' => '传真号码',
            'email' => '电子邮件',
            'qq' => 'qq',
            'website' => '公司网站',
            'region' => '地区',
            'address' => '详细地址',
            'lines' => '乘车路线',
            'longitude' => '坐标经度',
            'latitude' => '坐标纬度',
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(),[
            'mobile.required_without' => '固定电话与手机号码必须填写一项',
            'mobile.mobile_verification'=>'请输入正确的手机号码',
            'phone.check_company_phone'=>'请输入正确的区号和电话号码',
            'phone.required_without' => '固定电话与手机号码必须填写一项',
            'fax.check_fax'=>'请输入正确的传真号码',
            'qq.check_qq'=>'请输入正确的qq号码',
        ]);
    }

}
